<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:in="http://java.sun.com/jsf/composite/inward"
                xmlns:p="http://primefaces.org/ui"
                xmlns:bi="http://java.sun.com/jsf/composite/inward/bill"
                xmlns:pe="http://primefaces.org/ui/extensions"
                xmlns:credit="http://java.sun.com/jsf/composite/inward/creditCompany">



    <ui:define name="content">

        <h:panelGroup >
            <h:form  >
                <p:panel  >
                    <f:facet name="header">
                        <p:outputLabel value="Inward Payment Bill - Estimated Professional Fees"/>
                        <p:commandButton ajax="false"  value="Refresh" style="float:right;" action="#{bhtSummeryController.createTablesWithEstimatedProfessionalFees()}" onclick="onSubmitButton();" />                        
                        <p:commandButton ajax="false"  value="Clear" style="float:right;" action="#{bhtSummeryController.clear}" onclick="onSubmitButton();" />                                                
                        <p:commandButton ajax="false" value="To Settle Bill" style="float:right;" action="#{bhtSummeryController.toSettle()}" onclick="onSubmitButton();" />
                        <p:commandButton ajax="false"  value="To Print Intrim Bill" action="#{bhtSummeryController.toPrintItrim()}" onclick="onSubmitButton();" />

                    </f:facet>
                    <h:panelGrid columns="3" style="min-width: 100%;">
                        <p:panel header="BHT">
                            <p:autoComplete converter="admis" widgetVar="aPt" id="acPt" forceSelection="true" 
                                            value="#{bhtSummeryController.patientEncounter}"
                                            completeMethod="#{admissionController.completePatientDishcargedNotFinalized}" 
                                            var="myItem" itemValue="#{myItem}" 
                                            itemLabel="#{myItem.bhtNo}" 
                                            size="30"  >
                                <p:ajax event="itemSelect" 
                                        process="@this" 
                                        update="@all" 
                                        listener="#{bhtSummeryController.createTablesWithEstimatedProfessionalFees()}"/>
                                <p:column>
                                    #{myItem.bhtNo}
                                </p:column>
                                <p:column>
                                    #{myItem.patient.person.nameWithTitle}
                                </p:column>
                                <p:column>
                                    <h:outputLabel value="#{myItem.currentPatientRoom.roomFacilityCharge.name}"/>
                                </p:column>
                                <p:column>
                                    <h:outputLabel value="Discharged"  rendered="#{myItem.discharged}"/>
                                </p:column>
                            </p:autoComplete>   
                            <h:panelGroup id="panSearch2">
                                <in:bhtDetail admission="#{bhtSummeryController.patientEncounter}"/>
                            </h:panelGroup>

                        </p:panel>


                        <h:panelGroup>
                            <p:panel header="Summary" id="tot">

                                <h:panelGroup id="crd" style="display: #{bhtSummeryController.patientEncounter.paymentMethod eq 'Credit' ? 'block' : 'none'} ;min-width: 100%; ">
                                    <credit:outputCredit  patientEncounter="#{bhtSummeryController.patientEncounter}"/>
                                </h:panelGroup>

                                <h:panelGrid columns="2" >
                                    <h:outputLabel  value="Total Charges : "  style="min-width: 100px;font-weight: bold;"/>
                                    <h:outputLabel value="#{bhtSummeryController.grantTotal}" style="float: right;">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputLabel>                               
                                    <h:outputLabel value="Paid By Patient :  " style="min-width: 100px;font-weight: bold;"/>
                                    <h:outputLabel value="#{bhtSummeryController.paid}" style="float: right;">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputLabel>
                                    <h:outputLabel value="Due : " style="min-width: 100px;font-weight: bold;"
                                                   rendered="#{bhtSummeryController.patientEncounter.paymentMethod ne 'Credit' 
                                                               and bhtSummeryController.due > 0 }" />
                                    <h:outputLabel  value="#{bhtSummeryController.due}"
                                                    rendered="#{bhtSummeryController.patientEncounter.paymentMethod ne 'Credit' 
                                                                and bhtSummeryController.due > 0 }" style="float: right;">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputLabel>
                                </h:panelGrid>

                            </p:panel>
                            <p:panel id="dis" header="Discharge">

                                <h:panelGrid columns="2">
                                    <p:outputLabel value="Discharge Time"/>
                                    <p:calendar value="#{bhtSummeryController.date}"
                                                id="dischargeTimeStamp"
                                                pattern="dd/MMM/yyyy - hh:mm:ss a" >                               
                                        <f:ajax execute="@this" render="sum tvPt tot" event="dateSelect" listener="#{bhtSummeryController.checkDate}" />
                                    </p:calendar> 
                                    <p:commandButton ajax="false" style="float: right;" value="Disharge" action="#{bhtSummeryController.discharge}" onclick="onSubmitButton();" />
                                    <p:commandButton ajax="false" style="float: right;" value="Disharge Cancel" action="#{bhtSummeryController.dischargeCancel}" onclick="onSubmitButton();" />
                                </h:panelGrid>
                            </p:panel>
                        </h:panelGroup>

                        <p:dataTable id="sum" value="#{bhtSummeryController.chargeItemTotals}" 
                                     style="max-width: 25%;" var="c" 
                                     rowStyleClass="#{c.total !=0?'':'noDisplayRow' }"
                                     scrollable="true" scrollHeight="250" scrollWidth="300"
                                     >

                            <p:column headerText="Charge Type" >
                                <h:outputLabel value="#{c.inwardChargeType.label}"/>
                            </p:column>
                            <p:column  style="text-align: right;" headerText="Total">
                                <h:outputLabel value="#{c.total}"   >
                                    <f:convertNumber pattern="#,##0.00"/>
                                </h:outputLabel>
                            </p:column>
                        </p:dataTable>

                    </h:panelGrid>

                    <p:tabView  id="tvPt" style="min-height: 75%;"  >                     
                        <p:tab id="tabNewPt" title="Room Detail" >

                            <p:dataTable   value="#{bhtSummeryController.patientRooms}" var="rm">                                
                                <p:column headerText="Room Name">
                                    <h:outputLabel value="#{rm.roomFacilityCharge.name}"/><br/>
                                    <h:outputLabel value="GAURDIAN ROOM" style="color: #008000;"
                                                   rendered="#{rm.patientRoomClass eq 'class com.divudi.entity.inward.GuardianRoom'}"/>
                                </p:column>                                                                          
                                <p:column headerText="Admitted At">
                                    <p:calendar navigator="true"  
                                                id="roomAdmittedTimeStamp"
                                                value="#{rm.admittedAt}" 
                                                pattern="dd/MMM/yyyy - hh:mm:ss a" />     
                                </p:column>
                                <p:column headerText="Discharged At">                                      
                                    <p:calendar navigator="true"  
                                                id="roomDischargeTimeStamp"
                                                value="#{rm.dischargedAt}" 
                                                pattern="dd/MMM/yyyy - hh:mm:ss a" /> 
                                </p:column>
                                <p:column headerText="Room Charge" style="text-align: right;">
                                    <h:outputLabel value="#{rm.calculatedRoomCharge}" >
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputLabel>                                        
                                </p:column>



                                <p:column headerText="Maintain Charge" style="text-align: right;">
                                    <h:outputLabel value="#{rm.calculatedMaintainCharge}">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputLabel>
                                </p:column>    
                                <p:column headerText="MO Charge" style="text-align: right;">
                                    <h:outputLabel  value="#{rm.calculatedMoCharge}">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputLabel>
                                </p:column>                                        
                                <p:column headerText="Nursing Charge" style="text-align: right;">
                                    <h:outputLabel value="#{rm.calculatedNursingCharge}">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputLabel>
                                </p:column> 
                                <p:column headerText="Linen Charge" style="text-align: right;">
                                    <h:outputLabel value="#{rm.calculatedLinenCharge}">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputLabel>
                                </p:column> 
                                <p:column headerText="Administration Charge" style="text-align: right;">
                                    <h:outputLabel value="#{rm.calculatedAdministrationCharge}">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputLabel>
                                </p:column> 
                                <p:column headerText="Madical Care Charge" style="text-align: right;">
                                    <h:outputLabel value="#{rm.calculatedMedicalCareCharge}">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputLabel>
                                </p:column>                                
                                <p:column>
                                    <p:commandButton ajax="false" value="Update Room"
                                                    action="#{roomChangeController.dischargeWithCurrentTime(rm)}"
                                                    actionListener="#{bhtSummeryController.updatePatientRoom(rm)}" 
                                                     onclick="onSubmitButton();"/>
                                </p:column> 
                                <p:column>
                                    <p:commandButton ajax="false" value="Cancel Discharge"
                                                    action="#{roomChangeController.dischargeCancel(rm)}"
                                                    actionListener="#{bhtSummeryController.updatePatientRoom(rm)}" 
                                                     onclick="onSubmitButton();"/>
                                </p:column> 

                            </p:dataTable>
                        </p:tab>


                        <p:tab id="tabTimed" title="Timed Service Detail"  >  
                            <p:dataTable  value="#{bhtSummeryController.patientItems}" var="pt">
                                <p:column headerText="Service Name">
                                    <h:outputLabel value="#{pt.item.name}"/>
                                </p:column>
                                <p:column headerText="Start Time">
                                    <p:calendar navigator="true"  
                                                id="serviceStartTimeStamp"
                                                value="#{pt.fromTime}" 
                                                pattern="dd/MM/yyyy  hh:mm:ss a" />           
                                </p:column>
                                <p:column headerText="Stopped Time">
                                    <p:calendar navigator="true"  
                                                id="serviceStoppedTimeStamp"
                                                value="#{pt.toTime}" 
                                                pattern="dd/MM/yyyy  hh:mm:ss a" />                                    
                                </p:column>
                                <p:column headerText="Total" style="text-align: right;">
                                    <h:outputLabel value="#{pt.serviceValue}">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputLabel>
                                </p:column>   
                                <p:column >
                                    <h:outputLabel value="#{ti.creater.webUserPerson.name}"/>     
                                    <br/>
                                    <h:panelGroup rendered="#{ti.retired}" >
                                        <h:outputLabel style="color: red;" value="Deleted By " />
                                        <h:outputLabel style="color: red;"  value="#{ti.retirer.webUserPerson.name}" >                                       
                                        </h:outputLabel>
                                    </h:panelGroup>
                                </p:column>     
                                <p:column headerText="Inward Charge Type">
                                    <h:outputLabel value="#{pt.item.inwardChargeType}"/>                                        
                                </p:column>   
                                <p:column >
                                    <p:commandButton ajax="false" value="Update" 
                                                    action="#{bhtSummeryController.updatePatientItem(pt)}" onclick="onSubmitButton();"/>
                                </p:column>
                                <p:column>
                                    <p:commandButton ajax="false" value="Remove "  
                                                    action="#{inwardTimedItemController.removePatientItem(ti)}" onclick="onSubmitButton();"/>
                                </p:column>
                            </p:dataTable>
                        </p:tab>

                        <p:tab id="tabSer" title="Service Detail"  >                            
                            <p:dataTable id="service" scrollable="true" scrollHeight="300" 
                                         value="#{bhtSummeryController.departmentBillItems}" var="dep">
                                <p:columnGroup type="header">
                                    <p:row>
                                        <p:column >
                                            <f:facet name="header">
                                                <h:outputLabel value="Item Name"/>
                                            </f:facet>
                                        </p:column>
                                        <p:column >
                                            <f:facet name="header">
                                                <h:outputLabel value="Count"/>

                                            </f:facet>
                                        </p:column>     
                                        <p:column >
                                            <f:facet name="header">
                                                <h:outputLabel value="Checked Count"/>
                                            </f:facet>
                                        </p:column>  
                                        <p:column >
                                            <f:facet name="header">
                                                <h:outputLabel value="Inward Charge Type"/>

                                            </f:facet>
                                        </p:column>     
                                        <p:column >
                                            <f:facet name="header">
                                                <h:outputLabel value="View Bill"/>

                                            </f:facet>
                                        </p:column>
                                    </p:row>
                                </p:columnGroup>

                                <p:subTable value="#{dep.items}" var="ser">
                                    <f:facet name="header">
                                        <h:outputLabel value="#{dep.department.name}"/>
                                    </f:facet>
                                    <p:column>
                                        <h:outputLabel value="#{ser.name}" rendered="#{ser.transBillItemCount ne 0}"/>                                        
                                    </p:column>
                                    <p:column style="text-align: right;">
                                        <h:outputLabel value="#{ser.transBillItemCount}" rendered="#{ser.transBillItemCount ne 0}"/>
                                    </p:column>    
                                    <p:column style="text-align: right;">
                                        <h:outputLabel value="#{ser.transCheckedCount}" rendered="#{ser.transBillItemCount ne 0}"/>
                                    </p:column>    
                                    <p:column>
                                        <h:outputLabel value="#{ser.inwardChargeType}" rendered="#{ser.transBillItemCount ne 0}"/>                                        
                                    </p:column>
                                    <p:column>
                                        <p:commandButton ajax="false" rendered="#{ser.transBillItemCount ne 0}"
                                                        action="inward_edit_bill_item_view"   
                                                         value="View Bill Items" onclick="onSubmitButton();" > 
                                            <f:setPropertyActionListener value="#{ser}" target="#{bhtSummeryController.item}"/>
                                        </p:commandButton>
                                    </p:column>
                                </p:subTable>
                            </p:dataTable>
                        </p:tab>

                        <p:tab title="Madicine Issue">                          
                            <p:dataTable value="#{bhtSummeryController.pharmacyIssues}" var="iss" scrollable="true"
                                         scrollHeight="300"
                                         rowStyleClass="#{((iss.billClass eq 'class com.divudi.entity.PreBill')
                                                          or 
                                                          (iss.billedBill ne null 
                                                          and iss.billClass eq 'class com.divudi.entity.RefundBill'))? '':'noDisplayRow'}">
                                <p:column headerText="Bill No">

                                    #{iss.deptId}
                                </p:column>                               
                                <p:column headerText="Bill Total" style="text-align: right;">
                                    <h:outputLabel  value="#{iss.netTotal}">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputLabel>
                                </p:column>
                                <p:column headerText="Billed Date">
                                    <h:outputLabel value="#{iss.createdAt}">
                                        <f:convertDateTime pattern="dd MM yyyy"/>
                                    </h:outputLabel>                                                   
                                    <br/>
                                    <h:panelGroup rendered="#{iss.cancelled}" >
                                        <h:outputLabel style="color: red;" value="Cancelled at " />
                                        <h:outputLabel style="color: red;" rendered="#{iss.cancelled}" 
                                                       value="#{iss.cancelledBill.createdAt}" >
                                            <f:convertDateTime pattern="dd MMM yyyy"/>
                                        </h:outputLabel>
                                    </h:panelGroup>
                                </p:column>
                                <p:column headerText="Billed Time" >
                                    <h:outputLabel value="#{iss.createdAt}">
                                        <f:convertDateTime pattern="hh mm ss a"/>
                                    </h:outputLabel>                                                   
                                    <br/>
                                    <h:panelGroup rendered="#{iss.cancelled}" >
                                        <h:outputLabel style="color: red;" value="Cancelled at " />
                                        <h:outputLabel style="color: red;" rendered="#{iss.cancelled}" 
                                                       value="#{iss.cancelledBill.createdAt}" >
                                            <f:convertDateTime pattern="hh mm ss a"/>
                                        </h:outputLabel>
                                    </h:panelGroup>
                                </p:column>
                                <p:column headerText="Billed By">
                                    <h:outputLabel value="#{iss.creater.webUserPerson.name}"/>     
                                    <br/>
                                    <h:panelGroup rendered="#{iss.cancelled}" >
                                        <h:outputLabel style="color: red;" value="Cancelled By " />
                                        <h:outputLabel style="color: red;" rendered="#{iss.cancelled}" 
                                                       value="#{iss.cancelledBill.creater.webUserPerson.name}" >                                       
                                        </h:outputLabel>
                                    </h:panelGroup>
                                </p:column>  
                                <p:column headerText="Checked By">
                                    <h:outputLabel value="#{iss.checkedBy.webUserPerson.name}"/>     
                                </p:column>  
                                <p:column headerText="Checked At">
                                    <h:outputLabel value="#{iss.checkeAt}">
                                        <f:convertDateTime pattern="dd/MMM/yyyy - hh:mm:ss a"/>
                                    </h:outputLabel>      
                                </p:column>  
                                <p:column>
                                    <p:commandButton ajax="false" action="pharmacy_reprint_bill_sale_bht" 
                                                     rendered="#{iss.billClass eq 'class com.divudi.entity.PreBill'}" value="View Issue" onclick="onSubmitButton();" >                                              
                                        <f:setPropertyActionListener value="#{iss}" target="#{pharmacyBillSearch.bill}"/>
                                    </p:commandButton>
                                    <p:commandButton ajax="false" action="pharmacy_reprint_bill_return_bht" 
                                                     rendered="#{iss.billClass eq 'class com.divudi.entity.RefundBill'}"
                                                     value="View Return" onclick="onSubmitButton();" >                                              
                                        <f:setPropertyActionListener value="#{iss}" target="#{pharmacyBillSearch.bill}"/>
                                    </p:commandButton>
                                </p:column>
                            </p:dataTable>
                        </p:tab>

                        <p:tab title="Store Issue">                          
                            <p:dataTable value="#{bhtSummeryController.storeIssues}" var="iss" scrollable="true"
                                         scrollHeight="300"
                                         rowStyleClass="#{((iss.billClass eq 'class com.divudi.entity.PreBill')
                                                          or 
                                                          (iss.billedBill ne null 
                                                          and iss.billClass eq 'class com.divudi.entity.RefundBill'))? '':'noDisplayRow'}">
                                <p:column headerText="Bill No">

                                    #{iss.deptId}
                                </p:column>                               
                                <p:column headerText="Bill Total" style="text-align: right;">
                                    <h:outputLabel  value="#{iss.netTotal}">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputLabel>
                                </p:column>
                                <p:column headerText="Billed Date">
                                    <h:outputLabel value="#{iss.createdAt}">
                                        <f:convertDateTime pattern="dd MM yyyy"/>
                                    </h:outputLabel>                                                   
                                    <br/>
                                    <h:panelGroup rendered="#{iss.cancelled}" >
                                        <h:outputLabel style="color: red;" value="Cancelled at " />
                                        <h:outputLabel style="color: red;" rendered="#{iss.cancelled}" 
                                                       value="#{iss.cancelledBill.createdAt}" >
                                            <f:convertDateTime pattern="dd MMM yyyy"/>
                                        </h:outputLabel>
                                    </h:panelGroup>
                                </p:column>
                                <p:column headerText="Billed Time" >
                                    <h:outputLabel value="#{iss.createdAt}">
                                        <f:convertDateTime pattern="hh mm ss a"/>
                                    </h:outputLabel>                                                   
                                    <br/>
                                    <h:panelGroup rendered="#{iss.cancelled}" >
                                        <h:outputLabel style="color: red;" value="Cancelled at " />
                                        <h:outputLabel style="color: red;" rendered="#{iss.cancelled}" 
                                                       value="#{iss.cancelledBill.createdAt}" >
                                            <f:convertDateTime pattern="hh mm ss a"/>
                                        </h:outputLabel>
                                    </h:panelGroup>
                                </p:column>
                                <p:column headerText="Billed By">
                                    <h:outputLabel value="#{iss.creater.webUserPerson.name}"/>     
                                    <br/>
                                    <h:panelGroup rendered="#{iss.cancelled}" >
                                        <h:outputLabel style="color: red;" value="Cancelled By " />
                                        <h:outputLabel style="color: red;" rendered="#{iss.cancelled}" 
                                                       value="#{iss.cancelledBill.creater.webUserPerson.name}" >                                       
                                        </h:outputLabel>
                                    </h:panelGroup>
                                </p:column>  
                                <p:column headerText="Checked By">
                                    <h:outputLabel value="#{iss.checkedBy.webUserPerson.name}"/>     
                                </p:column>  
                                <p:column headerText="Checked At">
                                    <h:outputLabel value="#{iss.checkeAt}">
                                        <f:convertDateTime pattern="dd/MMM/yyyy - hh:mm:ss a"/>
                                    </h:outputLabel>      
                                </p:column>  
                                <p:column>
                                    <p:commandButton ajax="false" action="store_reprint_bill_sale_bht" 
                                                     rendered="#{iss.billClass eq 'class com.divudi.entity.PreBill'}" value="View Issue" onclick="onSubmitButton();" >                                              
                                        <f:setPropertyActionListener value="#{iss}" target="#{storeBillSearch.bill}"/>
                                    </p:commandButton>
                                    <p:commandButton ajax="false" action="store_reprint_bill_return_bht" 
                                                     rendered="#{iss.billClass eq 'class com.divudi.entity.RefundBill'}"
                                                     value="View Return" onclick="onSubmitButton();" >                                              
                                        <f:setPropertyActionListener value="#{iss}" target="#{storeBillSearch.bill}"/>
                                    </p:commandButton>
                                </p:column>
                            </p:dataTable>
                        </p:tab>

                        <p:tab id="tabAdd" title="Out Side Charge Detail"  >
                            <p:dataTable    scrollable="true" scrollHeight="300" 
                                            value="#{bhtSummeryController.additionalChargeBill}" var="bil"
                                            rowStyleClass="#{((bil.billClass eq 'class com.divudi.entity.BilledBill')
                                                             or 
                                                             (bil.billedBill eq null 
                                                             and bil.billClass eq 'class com.divudi.entity.RefundBill'))? '':'noDisplayRow'}">
                                <p:column headerText="Name">
                                    #{bil.comments}
                                </p:column>
                                <p:column headerText="Cost" style="text-align: right;">
                                    <h:outputLabel  value="#{bil.total}">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputLabel>
                                </p:column>

                                <p:column headerText="Added Date">
                                    <h:outputLabel value="#{bil.createdAt}">
                                        <f:convertDateTime pattern="dd MM yyyy"/>
                                    </h:outputLabel>                                                  
                                    <br/>
                                    <h:panelGroup rendered="#{bil.cancelled}" >
                                        <h:outputLabel style="color: red;" value="Cancelled at " />
                                        <h:outputLabel style="color: red;" rendered="#{bil.cancelled}" 
                                                       value="#{bil.cancelledBill.createdAt}" >
                                            <f:convertDateTime pattern="dd MM yyyy"/>
                                        </h:outputLabel>
                                    </h:panelGroup>
                                </p:column>
                                <p:column headerText="Added Time">
                                    <h:outputLabel value="#{bil.createdAt}">
                                        <f:convertDateTime pattern="hh mm ss a"/>
                                    </h:outputLabel>                                                   
                                    <br/>
                                    <h:panelGroup rendered="#{bil.cancelled}" >
                                        <h:outputLabel style="color: red;" value="Cancelled at " />
                                        <h:outputLabel style="color: red;" rendered="#{bil.cancelled}" 
                                                       value="#{bil.cancelledBill.createdAt}" >
                                            <f:convertDateTime pattern="hh mm ss a"/>
                                        </h:outputLabel>
                                    </h:panelGroup>
                                </p:column>
                                <p:column headerText="Added User">
                                    <h:outputLabel value="#{bil.creater.webUserPerson.name}"/>     
                                    <br/>
                                    <h:panelGroup rendered="#{bil.cancelled}" >
                                        <h:outputLabel style="color: red;" value="Cancelled By " />
                                        <h:outputLabel style="color: red;" rendered="#{bil.cancelled}" 
                                                       value="#{bil.cancelledBill.creater.webUserPerson.name}" >                                       
                                        </h:outputLabel>
                                    </h:panelGroup>
                                </p:column>
                                <p:column headerText="Checked User">
                                    <h:outputLabel value="#{bil.checkedBy.webUserPerson.name}"/>                                        
                                </p:column>
                                <p:column headerText="Checked Time">
                                    <h:outputLabel value="#{bil.checkeAt}">
                                        <f:convertDateTime pattern="yy mm dd hh mm ss a"/>
                                    </h:outputLabel>                                                                                      
                                </p:column>
                                <p:column headerText="Inward Charge Type">
                                    <h:outputLabel  value="#{bil.singleBillItem.inwardChargeType}">                                     
                                    </h:outputLabel>
                                </p:column>

                                <p:column>
                                    <p:commandButton ajax="false" action="inward_reprint_bill" value="View Bill" onclick="onSubmitButton();">                                        
                                        <f:setPropertyActionListener value="#{bil}" target="#{inwardSearch.bill}"/>
                                    </p:commandButton>

                                </p:column>

                            </p:dataTable>
                        </p:tab>



                        <p:tab id="tabPro" title="Professional Fee"  >
                            <p:dataTable  scrollable="true" scrollHeight="300"  
                                          value="#{bhtSummeryController.profesionallFee}" var="pf"
                                          rowStyleClass="#{pf.bill.billClass eq 'class com.divudi.entity.BilledBill' ? '':'noDisplayRow'}">
                                <p:column headerText="Name">
                                    #{pf.staff.person.nameWithTitle}
                                </p:column>
                                <p:column headerText="Fee Value" style="text-align: right;">
                                    <h:outputLabel value="#{pf.feeValue}">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputLabel>
                                </p:column>
                                <p:column headerText="Fee At">
                                    <h:outputLabel value="#{pf.feeAt}">
                                        <f:convertDateTime pattern="dd MMMM yyyy hh mm ss a"/>
                                    </h:outputLabel>
                                </p:column>
                                <p:column headerText="Added Time">                                      
                                    <h:outputLabel value="#{pf.createdAt}">
                                        <f:convertDateTime pattern="dd/MMM/yyyy - hh:mm:ss a"/>
                                    </h:outputLabel>                                                   
                                    <br/>
                                    <h:panelGroup rendered="#{pf.bill.cancelled}" >
                                        <h:outputLabel style="color: red;" value="Cancelled at " />
                                        <h:outputLabel style="color: red;" rendered="#{pf.bill.cancelled}" 
                                                       value="#{pf.bill.cancelledBill.createdAt}" >
                                            <f:convertDateTime pattern="dd/MMM/yyyy - hh:mm:ss a"/>
                                        </h:outputLabel>
                                    </h:panelGroup>
                                </p:column>
                                <p:column headerText="Added User">
                                    <h:outputLabel value="#{pf.bill.creater.webUserPerson.name}"/>     
                                    <br/>
                                    <h:panelGroup rendered="#{pf.bill.cancelled}" >
                                        <h:outputLabel style="color: red;" value="Cancelled By " />
                                        <h:outputLabel style="color: red;" rendered="#{pf.bill.cancelled}" 
                                                       value="#{pf.bill.cancelledBill.creater.webUserPerson.name}" >                                       
                                        </h:outputLabel>
                                    </h:panelGroup>
                                </p:column>
                                <p:column headerText="Checked User">
                                    <h:outputLabel value="#{pf.bill.checkedBy.creater.webUserPerson.name}"/>                                         
                                </p:column>
                                <p:column headerText="Checked At">
                                    <h:outputLabel value="#{pf.bill.checkeAt}">                                         
                                        <f:convertDateTime pattern="dd/MMM/yyyy - hh:mm:ss a"/>
                                    </h:outputLabel>
                                </p:column>
                                <p:column>
                                    <p:commandButton ajax="false" action="inward_reprint_bill_professional" value="View " onclick="onSubmitButton();">                                        
                                        <f:setPropertyActionListener value="#{pf.bill}" target="#{inwardSearch.bill}"/>
                                    </p:commandButton>
                                </p:column>
                            </p:dataTable>
                        </p:tab>


                        <p:tab id="tabDoc" title="Assisting Fee"  >
                            <p:dataTable  scrollable="true" scrollHeight="300"  value="#{bhtSummeryController.doctorAndNurseFee}" var="pf"
                                          rowStyleClass="#{pf.bill.billClass eq 'class com.divudi.entity.BilledBill' ? '':'noDisplayRow'}">
                                <p:column headerText="Name">
                                    #{pf.staff.person.nameWithTitle}
                                </p:column>
                                <p:column headerText="Fee Value" style="text-align: right;">
                                    <h:outputLabel value="#{pf.feeValue}">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputLabel>
                                </p:column>
                                <p:column headerText="Fee At">
                                    <h:outputLabel value="#{pf.feeAt}">
                                        <f:convertDateTime pattern="dd MMMM yyyy hh mm ss a"/>
                                    </h:outputLabel>
                                </p:column>
                                <p:column headerText="Added Time">                                      
                                    <h:outputLabel value="#{pf.createdAt}">
                                        <f:convertDateTime pattern="dd/MMM/yyyy - hh:mm:ss a"/>
                                    </h:outputLabel>                                                   
                                    <br/>
                                    <h:panelGroup rendered="#{pf.bill.cancelled}" >
                                        <h:outputLabel style="color: red;" value="Cancelled at " />
                                        <h:outputLabel style="color: red;" rendered="#{pf.bill.cancelled}" 
                                                       value="#{pf.bill.cancelledBill.createdAt}" >
                                            <f:convertDateTime pattern="dd/MMM/yyyy - hh:mm:ss a"/>
                                        </h:outputLabel>
                                    </h:panelGroup>
                                </p:column>
                                <p:column headerText="Added User">
                                    <h:outputLabel value="#{pf.creater.webUserPerson.name}"/>     
                                    <br/>
                                    <h:panelGroup rendered="#{pf.bill.cancelled}" >
                                        <h:outputLabel style="color: red;" value="Cancelled By " />
                                        <h:outputLabel style="color: red;" rendered="#{pf.bill.cancelled}" 
                                                       value="#{pf.bill.cancelledBill.creater.webUserPerson.name}" >                                       
                                        </h:outputLabel>
                                    </h:panelGroup>
                                </p:column>
                                <p:column headerText="Checked User">
                                    <h:outputLabel value="#{pf.bill.checkedBy.creater.webUserPerson.name}"/>                                         
                                </p:column>
                                <p:column headerText="Checked At">
                                    <h:outputLabel value="#{pf.bill.checkeAt}">                                         
                                        <f:convertDateTime pattern="dd/MMM/yyyy - hh:mm:ss a"/>
                                    </h:outputLabel>
                                </p:column>
                                <p:column>
                                    <p:commandButton ajax="false" action="inward_reprint_bill_professional" value="View Bill" onclick="onSubmitButton();">
                                        <f:setPropertyActionListener value="#{pf.bill}" target="#{inwardSearch.bill}"/>
                                    </p:commandButton>
                                </p:column>
                            </p:dataTable>
                        </p:tab>

                        <p:tab id="tabP" title="Payments"  >
                            <p:dataTable  scrollable="true" scrollHeight="300"  
                                          value="#{bhtSummeryController.paymentBill}" 
                                          var="p"
                                          rowStyleClass="#{((p.billClass eq 'class com.divudi.entity.BilledBill')
                                                           or 
                                                           (p.refundedBill eq null and p.billClass eq 'class com.divudi.entity.RefundBill'))? '':'noDisplayRow'}" >
                                <p:column headerText="Bill No">
                                    #{p.insId}
                                </p:column>

                                <p:column headerText="Paid At">  
                                    <h:outputLabel value="#{p.createdAt}">
                                        <f:convertDateTime pattern="dd/MMM/yyyy - hh:mm:ss a"/>
                                    </h:outputLabel>                                                   
                                    <br/>
                                    <h:panelGroup rendered="#{p.cancelled}" >
                                        <h:outputLabel style="color: red;" value="Cancelled at " />
                                        <h:outputLabel style="color: red;" rendered="#{p.cancelled}" 
                                                       value="#{p.cancelledBill.createdAt}" >
                                            <f:convertDateTime pattern="dd/MMM/yyyy - hh:mm:ss a"/>
                                        </h:outputLabel>
                                    </h:panelGroup>
                                </p:column>
                                <p:column headerText="Added User">
                                    <h:outputLabel value="#{p.creater.webUserPerson.name}"/>     
                                    <br/>
                                    <h:panelGroup rendered="#{p.cancelled}" >
                                        <h:outputLabel style="color: red;" value="Cancelled By " />
                                        <h:outputLabel style="color: red;" rendered="#{p.cancelled}" 
                                                       value="#{p.cancelledBill.creater.webUserPerson.name}" >                                       
                                        </h:outputLabel>
                                    </h:panelGroup>
                                </p:column>
                                <p:column headerText="Value" style="text-align: right;">
                                    <h:outputLabel  value="#{p.netTotal}">
                                        <f:convertNumber pattern="#,##0.00"/>
                                    </h:outputLabel>
                                </p:column>
                                <p:column headerText="Checked User">
                                    <h:outputLabel value="#{p.checkedBy.creater.webUserPerson.name}"/>                                         
                                </p:column>
                                <p:column headerText="Checked At">
                                    <h:outputLabel value="#{p.checkeAt}">                                         
                                        <f:convertDateTime pattern="dd/MMM/yyyy - hh:mm:ss a"/>
                                    </h:outputLabel>
                                </p:column>
                                <p:column>
                                    <p:commandButton ajax="false" action="inward_reprint_bill_payment" value="View Bill" onclick="onSubmitButton();">
                                        <f:setPropertyActionListener value="#{p}" target="#{inwardSearch.bill}"/>
                                    </p:commandButton>
                                </p:column>
                            </p:dataTable>
                        </p:tab>

                    </p:tabView>


                </p:panel>


            </h:form>

        </h:panelGroup>



    </ui:define>

</ui:composition>
